<template>
  <div>
    <van-pull-refresh>
      <van-sticky>
        <van-row style="background: #fff">
          <form action="/">
            <van-search
            v-model="valueshru"
            show-action
            placeholder="请输入搜索关键词"
            @search="onSearch"
            @cancel="onCancel"
            />
          </form>
        </van-row>
      </van-sticky>

      <!-- <van-pull-refresh v-model="isLoading" @refresh="onRefresh"> -->
      <!--
  <van-grid square>
    <van-grid-item v-for="value in 8" :key="value" icon="photo-o" text="文字" />
  </van-grid>
-->

<van-grid :column-num="5">
  <van-grid-item v-for="(n, inx) in goods_icon" :key="inx">
    <img :src="n.imgurl" />
    <div>{{ n.goods_txt }}</div>
  </van-grid-item>
</van-grid>

<van-swipe :autoplay="2000" indicator-color="white" class="index_swipe">
  <van-swipe-item v-for="(image, index) in images" :key="index">
    <img :src="image" style="" />
  </van-swipe-item>
</van-swipe>

<p></p>

<div>
  <van-grid :column-num="2" :square="true">
    <van-grid-item
    v-for="(n, inx) in LocalData"
    :key="inx"
    class="grid_index"
    >
    <img src="../image/meinv.jpg" style="width: 100%; height: 65%" />
    <div style="font-size: 0.25rem">{{ n.shopsname }} - 石家庄店</div>

    <div>
      <van-tag plain type="primary" class="tag_index">
        先装修后支付</van-tag
        >
        <van-tag plain type="primary" class="tag_index"> 样板间</van-tag>
      </div>
      <div>
        <span style="font-size: 0.2rem">
          {{ n.suppliertype == "1" ? "自营签约门店" : "平台签约门店" }}
        </span>

        <span>1.8km</span>
      </div>

      <div style="height: 2rem"></div>
    </van-grid-item>
  </van-grid>
</div>

      <!--
  <div style='height: 1.5rem;background:#666; font-size: 0.5rem'>
    土巴兔app应用程序
  </div> -->

  <div style="height: 1.5rem"></div>
</van-pull-refresh>
<footer_active></footer_active>
</div>
</template>

<script>

  import axios from "axios";
// import { findAll } from "../api/Local_lian.js";
import footer_active from "./footer_active";
import { Toast } from "vant";

export default {
  name: "app_index",
  data() {
    return {
      LocalData: [],
      rowValue: {},
      shangpin_icon: [],
      params: { page: 1, size: 5, total: 0 },
      valueshru: "",
      count: 0,
      isLoading: false,
      active: "home",
      images: "",
      search_v: "",
      goods_icon: "",
      // shangpin_icon:''
    };
  },
  components: {
    footer_active,
  },

  methods: {
    // onRefresh() {
    //   setTimeout(() => {
    //     Toast('刷新成功');
    //     this.isLoading = false;
    //     this.count++;
    //   }, 1000);
    // },
    onSearch(val) {
      Toast(val);
    },
    onCancel() {
      Toast("取消");
    },

    getList(data) {
      findAll(this.params).then((res) => {
        console.log("res:"+res);
        this.LocalData = res.data.data.rows;
      });
    },
  },

  created() {
    this.getList();
    axios.get("http://localhost:5632/images_icon").then((_e) => {
      this.images = _e.data;
    });

    axios.get("http://localhost:5632/getgoods_icon").then((_d) => {
      this.goods_icon = _d.data;
    });

    // axios.get('http://localhost:5632/shangpin_icon')
    // .then(_f =>{
    //  this.shangpin_icon = _f.data;
    // });
  }
}
</script>
    <!--
       ,{  图片在本地要加上require
      imgurl:require('http://yanxuan.nosdn.127.net/c6fd8835a6400b7da7a016ad85506b69.png'),
      goods_txt:'细品收费'
    }-->

    <style scoped>
    .index_hear_search {
      width: 4rem;
      border-radius: 4rem;
    }

    .index_button_search {
      width: 2rem;
      height: 0.5rem;
    }
    .tag_index {
      font-size: 0.2rem;
      padding: 0.05rem;
      margin: 0.1rem 0rem 0.1rem 0rem;
    }
    .grid_index {
      width: 100%;
      height: 4.2rem;
    }
  </style>
